import Vue from 'vue'
import VueRouter from 'vue-router'
// import Utils from '../utils/util.js'

Vue.use(VueRouter)

const routes = [{
		path: '/',
		redirect: '/index',
		meta: {
			title: '',
		},
	},
	{
		path: '/login',
		name: 'Login',
		meta: {
			title: '',
		},
		component: () => import('@/views/login')
	},
	{
		path: '/index',
		name: 'Index',
		meta: {
			title: '',
		},
		component: () => import('@/views/index')
	},
	{
		path: '/list',
		name: 'List',
		meta: {
			title: '',
		},
		component: () => import('@/views/list')
	},
	{
		path: '/policy',
		name: 'Policy',
		meta: {
			title: '',
		},
		component: () => import('@/views/policy')
	},
	{
		path: '/policyDetails',
		name: 'PolicyDetails',
		meta: {
			title: '',
		},
		component: () => import('@/views/policyDetails')
	},
	{
		path: '/tips',
		name: 'tips',
		meta: {
			title: '',
		},
		component: () => import('@/views/tips')
	},
	{
		path: '/tipsDetails',
		name: 'TipsDetails',
		meta: {
			title: '',
		},
		component: () => import('@/views/tipsDetails')
	},
	{
		path: '/class',
		name: 'Class',
		meta: {
			title: '',
		},
		component: () => import('@/views/class')
	},
	{
		path: '/details',
		name: 'Details',
		meta: {
			title: '',
		},
		component: () => import('@/views/details')
	},
	{
		path: '/video',
		name: 'Video',
		meta: {
			title: '',
		},
		component: () => import('@/views/video')
	}
]


const router = new VueRouter({
	mode: 'hash', // history
	scrollBehavior: () => ({
		y: 0
	}),
	base: process.env.BASE_URL,
	routes
})

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}

export default router
